package com.example.r2dbcdemo.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Table;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table("t_author")
public class TAuthor {
    @Id
    Long id;
    String name;

    //1-N如何封装
    @Transient //临时字段，并不是数据库表中的一个字段
//    @Field(exist=false)
    private List<TBook> books;

    public TAuthor(Long id, String name) {
        this.id = id;
        this.name = name;
    }
}
